from rest_framework import serializers

from xyz.models import Recruit, Enterprise


class EnterpriseSerializer(serializers.ModelSerializer):

    class Meta:
        model = Enterprise

        fields = ('id', 'name', 'labels', 'logo', 'recruits', 'summary')


class RecruitSerializer(serializers.ModelSerializer):
    enterprise = EnterpriseSerializer()

    class Meta:

        model = Recruit

        fields = ('id', 'jobname', 'salary', 'condition', 'education', 'type', 'city', 'createtime', 'enterprise', 'labels')